/**
 * Created by Administrator on 2017\9\7 0007.
 */
import React from 'react';
import template from './../commonui/template';
import { Link } from 'react-router-dom';
import { Form, Input, Tooltip, Icon, Cascader, Select, Row, Col, Checkbox, Button, AutoComplete } from 'antd';
const FormItem=Form.Item;
class ReigisterCusomer extends React.Component{
    constructor(props){
        super(props);
        this.drawForm=this.drawForm.bind(this);
        this.handleSubmit=this.handleSubmit.bind(this);
        this.state={
            lb:'个人用户',
            confirmDirty:false
        }
    }
    handleSubmit(e){
        console.log(e);
        console.log(this.props.form);
        e.preventDefault();

    }
    handleConfirmBlur(e){
        const value = e.target.value;
        console.log(value);
        console.log(!!value);
        this.setState({confirmDirty:this.state.confirmDirty||!!value})
    }
    checkPassword=(rule,value,callback)=>{
        const form = this.props.form;
        if(value&&value!==form.getFieldvalue('password')){
            callback('Two passwords that you enter is inconsistent!');
        }else{
            callback();
        }
    }
    checkConfirm=(rule,value,callback)=>{
        const form = this.props.form;
        if(value&&this.state.confirmDirty){
            form.validateFields(['confirm'],{force:true});
        }
        callback();
    }
    drawForm(){
        debugger;
      /*  else{
            return (
                <div>
                    <Form onsubmit={this.handleSubmit}>
                        <div>
                            <img src=" " title="icon_computer"/>
                            <div>
                                <FormItem label="Username">{getFieldDecorator('Username',{
                                    rules:[{required:true,message:'Please input your Username '}]
                                })(<Input />)
                                }
                                </FormItem>
                                <FormItem label="Password">{getFieldDecorator('Password',{
                                    rules:[{required:true,message:'Please input your password '},{
                                        validator:this.checkConfirm,
                                    }]
                                })(<Input type="password" />)
                                }
                                </FormItem>
                                 <FormItem label="Re-enter">{getFieldDecorator('Re-enter',{
                                    rules:[{required:true,message:'Please input your Re-enter '},{
                                        validator:this.checkPassword,
                                    }]
                                })(<Input type="password" onblur={this.handleConfirmBlur}/>)
                                }
                                </FormItem>
                            </div>
                        </div>
                        <div></div>
                        <div>
                            <img src="" title="icon_people"/>
                            <div>
                                <FormItem label="Company">{getFieldDecorator('company',{
                                    rules:[{required:true,message:'Please input your company'}]
                                })(<Input />)
                                }
                                </FormItem>
                                <FormItem label="Landline-Number">{getFieldDecorator('Landline',{
                                    rules:[{required:true,message:'Please input your Landline'}]
                                })(<Input />)
                                }
                                </FormItem>
                                <FormItem label="E-mail">{getFieldDecorator('email',{
                                    rules:[{required:true,message:'Please input your email'}]
                                })(<Input />)
                                }
                                </FormItem>
                            </div>
                            <div>
                                <FormItem>
                                    <button type="primary" htmlType="submit">Register</button>
                                </FormItem>
                            </div>
                        </div>
                    </Form>
                </div>
            )
        }*/
    }
    render(){
       debugger;
         return (<div>
             <div>{this.state.lb}</div>

        </div>

      )
    }
}

export default template({
    id: 'ReigisterCusomer',
    component: ReigisterCusomer
});